<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>employee vacation</title>
</head>
<body>

<form id="form" action="" method="post">
    <input type="hidden" id="vacationId" name="vacationId">
</form>

<p>
    <input type="button" name="Submit6" value="新建请假单" onclick="addVacation()" />
    <input type="button" name="Submit6" value="登出" onclick="logout()" />
</p>
<table width="870" height="118" border="1">
    <tr>
        <td width="62"><div align="center"><span class="STYLE3">姓名</span></div></td>
        <td width="67"><div align="center"><span class="STYLE3">请假类型</span></div></td>
        <td width="106"><div align="center"><span class="STYLE3">开始时间</span></div></td>
        <td width="104"><div align="center"><span class="STYLE3">结束时间</span></div></td>
        <td width="110"><div align="center"><span class="STYLE3">备注</span></div></td>
        <td width="56"><div align="center"><span class="STYLE3">部门</span></div></td>
        <td width="66"><div align="center"><span class="STYLE3">照片</span></div></td>
        <td width="117"><div align="center"><span class="STYLE3">审批状态</span></div></td>
        <td width="124"><div align="center"><span class="STYLE3">操作</span></div></td>
    </tr>
    <tr th:each="vacation : ${vacationVoList}" >
        <td th:text="${vacation.empName}">张三</td>
        <td th:text="${vacation.vacationType}">病假</td>
        <td th:text="${#dates.format(vacation.vacationStartTime, 'yyyy-MM-dd')}">2021-11-12</td>
        <td th:text="${#dates.format(vacation.vacationEndTime, 'yyyy-MM-dd')}">2021-11-12</td>
        <td th:text="${vacation.remark}">住院</td>
        <td th:text="${vacation.deptName}">开发部</td>
        <td><img width="80px" height="80px" th:src="@{http://localhost/img/{a}(a=${vacation.pictureUrl})}"></td>
        <td th:text="${vacation.statusName}"></td>
        <td th:if="${vacation.vacationStatusId==1}"><input type="button" name="Submit4"  th:onclick="cancelApply([[${vacation.vacationId}]])"  value="撤销申请" /></td>
        <td th:unless="${vacation.vacationStatusId==1}">&nbsp;</td>

    </tr>

</table>

<p>
<a  th:href="@{/vacation/pageNum(pageNum=1,pageSize=${pageInfo.pageSize})}" >首页</a>
<a  th:href="@{/vacation/employee(pageNum=${pageInfo.prePage},pageSize=${pageInfo.pageSize})}" >上一页</a>
<a  th:href="@{/vacation/employee(pageNum=${pageInfo.nextPage},pageSize=${pageInfo.pageSize})}" >下一页</a>
<a  th:href="@{/vacation/employee(pageNum=${pageInfo.pages},pageSize=${pageInfo.pageSize})}">末页</a>
总计<span th:text="${pageInfo.total}"></span>条 当前第<span th:text="${pageInfo.pageNum}"></span>页
</p>

</body>
<script>
    function cancelApply(vacationId) {
        var formObj = document.getElementById("form");
        var vacationIdObj = document.getElementById("vacationId");
        vacationIdObj.value=vacationId;
        formObj.action="/vacation/cancel/apply"
        formObj.submit();
    }
    function addVacation(){
        var formObj = document.getElementById("form");
        formObj.action="/vacation/toadd"
        formObj.submit();
    }

    function logout(){
        var formObj = document.getElementById("form");
        formObj.action="/vacation/logout"
        formObj.submit();
    }
</script>
</html>